3.200 \(\int \tan (e+f x) (a+b \tan ^2(e+f x))^2 \, dx\)

Optimal. Leaf size=62 \[ \frac{b (a-b) \tan ^2(e+f x)}{2 f}+\frac{\left (a+b \tan ^2(e+f x)\right )^2}{4 f}-\frac{(a-b)^2 \log (\cos (e+f x))}{f} \]

[Out]

-(((a - b)^2*Log[Cos[e + f*x]])/f) + ((a - b)*b*Tan[e + f*x]^2)/(2*f) + (a + b*Tan[e + f*x]^2)^2/(4*f)

________________________________________________________________________________________

Rubi [A]  time = 0.0604605, antiderivative size = 62, normalized size of antiderivative = 1., number of steps used = 4, number of rules used = 3, integrand size = 21, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.143, Rules used = {3670, 444, 43} \[ \frac{b (a-b) \tan ^2(e+f x)}{2 f}+\frac{\left (a+b \tan ^2(e+f x)\right )^2}{4 f}-\frac{(a-b)^2 \log (\cos (e+f x))}{f} \]

Antiderivative was successfully verified.

[In]

Int[Tan[e + f*x]*(a + b*Tan[e + f*x]^2)^2,x]

[Out]

-(((a - b)^2*Log[Cos[e + f*x]])/f) + ((a - b)*b*Tan[e + f*x]^2)/(2*f) + (a + b*Tan[e + f*x]^2)^2/(4*f)

Rule 3670

Int[((d_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((a_) + (b_.)*((c_.)*tan[(e_.) + (f_.)*(x_)])^(n_))^(p_.), x_Symbol]
 :> With[{ff = FreeFactors[Tan[e + f*x], x]}, Dist[(c*ff)/f, Subst[Int[(((d*ff*x)/c)^m*(a + b*(ff*x)^n)^p)/(c^
2 + ff^2*x^2), x], x, (c*Tan[e + f*x])/ff], x]] /; FreeQ[{a, b, c, d, e, f, m, n, p}, x] && (IGtQ[p, 0] || EqQ
[n, 2] || EqQ[n, 4] || (IntegerQ[p] && RationalQ[n]))

Rule 444

Int[(x_)^(m_.)*((a_) + (b_.)*(x_)^(n_))^(p_.)*((c_) + (d_.)*(x_)^(n_))^(q_.), x_Symbol] :> Dist[1/n, Subst[Int
[(a + b*x)^p*(c + d*x)^q, x], x, x^n], x] /; FreeQ[{a, b, c, d, m, n, p, q}, x] && NeQ[b*c - a*d, 0] && EqQ[m
- n + 1, 0]

Rule 43

Int[((a_.) + (b_.)*(x_))^(m_.)*((c_.) + (d_.)*(x_))^(n_.), x_Symbol] :> Int[ExpandIntegrand[(a + b*x)^m*(c + d
*x)^n, x], x] /; FreeQ[{a, b, c, d, n}, x] && NeQ[b*c - a*d, 0] && IGtQ[m, 0] && ( !IntegerQ[n] || (EqQ[c, 0]
&& LeQ[7*m + 4*n + 4, 0]) || LtQ[9*m + 5*(n + 1), 0] || GtQ[m + n + 2, 0])

Rubi steps

\begin{align*} \int \tan (e+f x) \left (a+b \tan ^2(e+f x)\right )^2 \, dx &=\frac{\operatorname{Subst}\left (\int \frac{x \left (a+b x^2\right )^2}{1+x^2} \, dx,x,\tan (e+f x)\right )}{f}\\ &=\frac{\operatorname{Subst}\left (\int \frac{(a+b x)^2}{1+x} \, dx,x,\tan ^2(e+f x)\right )}{2 f}\\ &=\frac{\operatorname{Subst}\left (\int \left ((a-b) b+\frac{(a-b)^2}{1+x}+b (a+b x)\right ) \, dx,x,\tan ^2(e+f x)\right )}{2 f}\\ &=-\frac{(a-b)^2 \log (\cos (e+f x))}{f}+\frac{(a-b) b \tan ^2(e+f x)}{2 f}+\frac{\left (a+b \tan ^2(e+f x)\right )^2}{4 f}\\ \end{align*}

Mathematica [A]  time = 0.2131, size = 54, normalized size = 0.87 \[ \frac{2 b (2 a-b) \tan ^2(e+f x)-4 (a-b)^2 \log (\cos (e+f x))+b^2 \tan ^4(e+f x)}{4 f} \]

Antiderivative was successfully verified.

[In]

Integrate[Tan[e + f*x]*(a + b*Tan[e + f*x]^2)^2,x]

[Out]

(-4*(a - b)^2*Log[Cos[e + f*x]] + 2*(2*a - b)*b*Tan[e + f*x]^2 + b^2*Tan[e + f*x]^4)/(4*f)

________________________________________________________________________________________

Maple [A]  time = 0.004, size = 104, normalized size = 1.7 \begin{align*}{\frac{{b}^{2} \left ( \tan \left ( fx+e \right ) \right ) ^{4}}{4\,f}}+{\frac{ \left ( \tan \left ( fx+e \right ) \right ) ^{2}ab}{f}}-{\frac{{b}^{2} \left ( \tan \left ( fx+e \right ) \right ) ^{2}}{2\,f}}+{\frac{\ln \left ( 1+ \left ( \tan \left ( fx+e \right ) \right ) ^{2} \right ){a}^{2}}{2\,f}}-{\frac{\ln \left ( 1+ \left ( \tan \left ( fx+e \right ) \right ) ^{2} \right ) ab}{f}}+{\frac{\ln \left ( 1+ \left ( \tan \left ( fx+e \right ) \right ) ^{2} \right ){b}^{2}}{2\,f}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(tan(f*x+e)*(a+b*tan(f*x+e)^2)^2,x)

[Out]

1/4/f*b^2*tan(f*x+e)^4+1/f*tan(f*x+e)^2*a*b-1/2*b^2*tan(f*x+e)^2/f+1/2/f*ln(1+tan(f*x+e)^2)*a^2-1/f*ln(1+tan(f
*x+e)^2)*a*b+1/2/f*ln(1+tan(f*x+e)^2)*b^2

________________________________________________________________________________________

Maxima [A]  time = 1.12846, size = 111, normalized size = 1.79 \begin{align*} -\frac{2 \,{\left (a^{2} - 2 \, a b + b^{2}\right )} \log \left (\sin \left (f x + e\right )^{2} - 1\right ) + \frac{4 \,{\left (a b - b^{2}\right )} \sin \left (f x + e\right )^{2} - 4 \, a b + 3 \, b^{2}}{\sin \left (f x + e\right )^{4} - 2 \, \sin \left (f x + e\right )^{2} + 1}}{4 \, f} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tan(f*x+e)*(a+b*tan(f*x+e)^2)^2,x, algorithm="maxima")

[Out]

-1/4*(2*(a^2 - 2*a*b + b^2)*log(sin(f*x + e)^2 - 1) + (4*(a*b - b^2)*sin(f*x + e)^2 - 4*a*b + 3*b^2)/(sin(f*x
+ e)^4 - 2*sin(f*x + e)^2 + 1))/f

________________________________________________________________________________________

Fricas [A]  time = 1.21043, size = 153, normalized size = 2.47 \begin{align*} \frac{b^{2} \tan \left (f x + e\right )^{4} + 2 \,{\left (2 \, a b - b^{2}\right )} \tan \left (f x + e\right )^{2} - 2 \,{\left (a^{2} - 2 \, a b + b^{2}\right )} \log \left (\frac{1}{\tan \left (f x + e\right )^{2} + 1}\right )}{4 \, f} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tan(f*x+e)*(a+b*tan(f*x+e)^2)^2,x, algorithm="fricas")

[Out]

1/4*(b^2*tan(f*x + e)^4 + 2*(2*a*b - b^2)*tan(f*x + e)^2 - 2*(a^2 - 2*a*b + b^2)*log(1/(tan(f*x + e)^2 + 1)))/
f

________________________________________________________________________________________

Sympy [A]  time = 0.526829, size = 112, normalized size = 1.81 \begin{align*} \begin{cases} \frac{a^{2} \log{\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )}}{2 f} - \frac{a b \log{\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )}}{f} + \frac{a b \tan ^{2}{\left (e + f x \right )}}{f} + \frac{b^{2} \log{\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )}}{2 f} + \frac{b^{2} \tan ^{4}{\left (e + f x \right )}}{4 f} - \frac{b^{2} \tan ^{2}{\left (e + f x \right )}}{2 f} & \text{for}\: f \neq 0 \\x \left (a + b \tan ^{2}{\left (e \right )}\right )^{2} \tan{\left (e \right )} & \text{otherwise} \end{cases} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tan(f*x+e)*(a+b*tan(f*x+e)**2)**2,x)

[Out]

Piecewise((a**2*log(tan(e + f*x)**2 + 1)/(2*f) - a*b*log(tan(e + f*x)**2 + 1)/f + a*b*tan(e + f*x)**2/f + b**2
*log(tan(e + f*x)**2 + 1)/(2*f) + b**2*tan(e + f*x)**4/(4*f) - b**2*tan(e + f*x)**2/(2*f), Ne(f, 0)), (x*(a +
b*tan(e)**2)**2*tan(e), True))

________________________________________________________________________________________

Giac [B]  time = 3.38934, size = 2039, normalized size = 32.89 \begin{align*} \text{result too large to display} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tan(f*x+e)*(a+b*tan(f*x+e)^2)^2,x, algorithm="giac")

[Out]

-1/4*(2*a^2*log(4*(tan(e)^2 + 1)/(tan(f*x)^4*tan(e)^2 - 2*tan(f*x)^3*tan(e) + tan(f*x)^2*tan(e)^2 + tan(f*x)^2
 - 2*tan(f*x)*tan(e) + 1))*tan(f*x)^4*tan(e)^4 - 4*a*b*log(4*(tan(e)^2 + 1)/(tan(f*x)^4*tan(e)^2 - 2*tan(f*x)^
3*tan(e) + tan(f*x)^2*tan(e)^2 + tan(f*x)^2 - 2*tan(f*x)*tan(e) + 1))*tan(f*x)^4*tan(e)^4 + 2*b^2*log(4*(tan(e
)^2 + 1)/(tan(f*x)^4*tan(e)^2 - 2*tan(f*x)^3*tan(e) + tan(f*x)^2*tan(e)^2 + tan(f*x)^2 - 2*tan(f*x)*tan(e) + 1
))*tan(f*x)^4*tan(e)^4 - 4*a*b*tan(f*x)^4*tan(e)^4 + 3*b^2*tan(f*x)^4*tan(e)^4 - 8*a^2*log(4*(tan(e)^2 + 1)/(t
an(f*x)^4*tan(e)^2 - 2*tan(f*x)^3*tan(e) + tan(f*x)^2*tan(e)^2 + tan(f*x)^2 - 2*tan(f*x)*tan(e) + 1))*tan(f*x)
^3*tan(e)^3 + 16*a*b*log(4*(tan(e)^2 + 1)/(tan(f*x)^4*tan(e)^2 - 2*tan(f*x)^3*tan(e) + tan(f*x)^2*tan(e)^2 + t
an(f*x)^2 - 2*tan(f*x)*tan(e) + 1))*tan(f*x)^3*tan(e)^3 - 8*b^2*log(4*(tan(e)^2 + 1)/(tan(f*x)^4*tan(e)^2 - 2*
tan(f*x)^3*tan(e) + tan(f*x)^2*tan(e)^2 + tan(f*x)^2 - 2*tan(f*x)*tan(e) + 1))*tan(f*x)^3*tan(e)^3 - 4*a*b*tan
(f*x)^4*tan(e)^2 + 2*b^2*tan(f*x)^4*tan(e)^2 + 8*a*b*tan(f*x)^3*tan(e)^3 - 8*b^2*tan(f*x)^3*tan(e)^3 - 4*a*b*t
an(f*x)^2*tan(e)^4 + 2*b^2*tan(f*x)^2*tan(e)^4 + 12*a^2*log(4*(tan(e)^2 + 1)/(tan(f*x)^4*tan(e)^2 - 2*tan(f*x)
^3*tan(e) + tan(f*x)^2*tan(e)^2 + tan(f*x)^2 - 2*tan(f*x)*tan(e) + 1))*tan(f*x)^2*tan(e)^2 - 24*a*b*log(4*(tan
(e)^2 + 1)/(tan(f*x)^4*tan(e)^2 - 2*tan(f*x)^3*tan(e) + tan(f*x)^2*tan(e)^2 + tan(f*x)^2 - 2*tan(f*x)*tan(e) +
 1))*tan(f*x)^2*tan(e)^2 + 12*b^2*log(4*(tan(e)^2 + 1)/(tan(f*x)^4*tan(e)^2 - 2*tan(f*x)^3*tan(e) + tan(f*x)^2
*tan(e)^2 + tan(f*x)^2 - 2*tan(f*x)*tan(e) + 1))*tan(f*x)^2*tan(e)^2 - b^2*tan(f*x)^4 + 8*a*b*tan(f*x)^3*tan(e
) - 8*b^2*tan(f*x)^3*tan(e) - 8*a*b*tan(f*x)^2*tan(e)^2 + 4*b^2*tan(f*x)^2*tan(e)^2 + 8*a*b*tan(f*x)*tan(e)^3
- 8*b^2*tan(f*x)*tan(e)^3 - b^2*tan(e)^4 - 8*a^2*log(4*(tan(e)^2 + 1)/(tan(f*x)^4*tan(e)^2 - 2*tan(f*x)^3*tan(
e) + tan(f*x)^2*tan(e)^2 + tan(f*x)^2 - 2*tan(f*x)*tan(e) + 1))*tan(f*x)*tan(e) + 16*a*b*log(4*(tan(e)^2 + 1)/
(tan(f*x)^4*tan(e)^2 - 2*tan(f*x)^3*tan(e) + tan(f*x)^2*tan(e)^2 + tan(f*x)^2 - 2*tan(f*x)*tan(e) + 1))*tan(f*
x)*tan(e) - 8*b^2*log(4*(tan(e)^2 + 1)/(tan(f*x)^4*tan(e)^2 - 2*tan(f*x)^3*tan(e) + tan(f*x)^2*tan(e)^2 + tan(
f*x)^2 - 2*tan(f*x)*tan(e) + 1))*tan(f*x)*tan(e) - 4*a*b*tan(f*x)^2 + 2*b^2*tan(f*x)^2 + 8*a*b*tan(f*x)*tan(e)
 - 8*b^2*tan(f*x)*tan(e) - 4*a*b*tan(e)^2 + 2*b^2*tan(e)^2 + 2*a^2*log(4*(tan(e)^2 + 1)/(tan(f*x)^4*tan(e)^2 -
 2*tan(f*x)^3*tan(e) + tan(f*x)^2*tan(e)^2 + tan(f*x)^2 - 2*tan(f*x)*tan(e) + 1)) - 4*a*b*log(4*(tan(e)^2 + 1)
/(tan(f*x)^4*tan(e)^2 - 2*tan(f*x)^3*tan(e) + tan(f*x)^2*tan(e)^2 + tan(f*x)^2 - 2*tan(f*x)*tan(e) + 1)) + 2*b
^2*log(4*(tan(e)^2 + 1)/(tan(f*x)^4*tan(e)^2 - 2*tan(f*x)^3*tan(e) + tan(f*x)^2*tan(e)^2 + tan(f*x)^2 - 2*tan(
f*x)*tan(e) + 1)) - 4*a*b + 3*b^2)/(f*tan(f*x)^4*tan(e)^4 - 4*f*tan(f*x)^3*tan(e)^3 + 6*f*tan(f*x)^2*tan(e)^2
- 4*f*tan(f*x)*tan(e) + f)